//
//  MemberStatisticTableViewCell.m
//  Rail
//
//  Created by hychen on 2018/3/5.
//  Copyright © 2018年 Hychen. All rights reserved.
//

#import "MemberStatisticTableViewCell.h"
@interface MemberStatisticTableViewCell ()

@property (weak, nonatomic) IBOutlet UIImageView *iconView;
@property (weak, nonatomic) IBOutlet UILabel *titleLabel;
@property (weak, nonatomic) IBOutlet UILabel *contentLabel;
@property (weak, nonatomic) IBOutlet UIImageView *rightImage;
@property (weak, nonatomic) IBOutlet UIImageView *leftImage;
@property (weak, nonatomic) IBOutlet UIImageView *levelImage;

@end
@implementation MemberStatisticTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    [self showArrowWithImage:nil];
    [self showBottomLineWithPaddingX:15 color:nil];
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

- (void)setModel:(WorkAreaUserModel *)model {
    _model = model;
    [self.iconView sd_setImageWithURL:[NSURL URLWithString:model.logo_url] placeholderImage:ImageNamed_bb(@"app_picture_default_img")];
    self.titleLabel.text = model.username;
    self.contentLabel.text = model.mobile;
    
    NSString *levelName = @"";
        switch (model.idtype) {
            case 0:
                levelName = @"list_shi_ic";
                break;
            case 1:
                //安
                levelName = @"list_an_ic";
                break;
            case 2:
                levelName = @"list_jian_ic";
                break;
            case 3:
                levelName = @"list_guan_ic";
                break;
            case 99:
                //系统
                levelName = @"list_xi_ic";
                break;
            case 98:
                //访客
                levelName = @"list_fang_ic";
                break;
            default:
                break;
        }

    self.levelImage.image = ImageNamed_bb(levelName);
    
    if (self.model.is_tbk) {
        self.rightImage.hidden = NO;
        self.rightImage.image = ImageNamed_bb(@"app_intercom_ic");
        if (self.model.is_locate) {
            self.leftImage.hidden = NO;
            self.leftImage.image = ImageNamed_bb(@"app_location_ring_ic");
        }
        else {
            self.leftImage.hidden = YES;
        }
    }
    else if (self.model.is_locate) {
        self.rightImage.hidden = NO;
        self.rightImage.image = ImageNamed_bb(@"app_location_ring_ic");
        self.leftImage.hidden = YES;
    }
}

@end
